package com.seeyoui.kensite.framework.cms.article.controller;

import java.net.InetAddress;
import java.net.UnknownHostException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.seeyoui.kensite.common.base.controller.BaseController;
import com.seeyoui.kensite.common.util.Result;
import com.seeyoui.kensite.framework.cms.article.domain.Article;
import com.seeyoui.kensite.framework.cms.article.domain.ArticleVO;
import com.seeyoui.kensite.framework.cms.article.service.ArticleQueryService;
import com.seeyoui.kensite.framework.cms.article.service.ArticleService;

@Controller
@RequestMapping("/mob")
public class ArticleMobileController extends BaseController {
	
	@Autowired
	private ArticleService articleService;
	@Autowired
	private ArticleQueryService articleQueryService;
	
	/**
	 * 文章详情，app端接口
	 * @param articleId
	 * @return
	 */
	@RequestMapping(value="/articleDetailMob",method=RequestMethod.POST)
	@ResponseBody
	public Result findArticleById(String articleId){
		/// TODO 根据用户id及文章id查询是否点赞，后续版本增加此功能
		/*SysUser sysUser = UserUtils.getUser(request);
		Study study = studyService.findStudyByUserIdAndArticleId(sysUser.getId(), articleId);*/
		System.out.println("ArticleMobileController.findArticleById()");
		//Article article = articleService.findOne(articleId);
		ArticleVO article = articleQueryService.findArticleDetailById(articleId);
		
		return Result.success(article);
	}
}
